<div class="sxdaqkk">
  <div nz-row>
    <div nz-col nzSpan="24">
      <nz-tabset (nzSelectedIndexChange)="tabCHange($event)" [nzSelectedIndex]="tabIndex">
        <nz-tab [nzTitle]="tabNames[0].text">
        </nz-tab>
        <nz-tab *ngIf="showTab2" [nzTitle]="tabNames[1].text">
        </nz-tab>
      </nz-tabset>
    </div>
  </div>
  <div nz-row>
    <div nz-col nzSpan="10" style="padding-bottom:10px;">
      <button class="margin-left10" nz-button nzType="default" (click)="goMain()" [disabled]="noLeaving()"><i nz-icon
          nzType="left" nzTheme="outline"></i>返回</button>
      <button class="margin-left10" nz-button nzType="primary" (click)="export()" [disabled]="noLeaving()"><i nz-icon
          nzType="download" nzTheme="outline"></i>导出</button>
      <ng-container *ngIf="queryParam.uSummary==='0'">
        <button class="margin-left10" nz-button nzType="primary" (click)="deleteAll()" [disabled]="noLeaving()"><i
            nz-icon nzType="delete" nzTheme="outline"></i>删除</button>
        <button class="margin-left10" nz-button nzType="primary" (click)="queRenAll()" [disabled]="noLeaving()"><i
            nz-icon nzType="check" nzTheme="outline"></i>确认</button>
      </ng-container>
    </div>
    <div nz-col nzSpan="14">
      <div class="queryBar">
        <ng-container *ngIf="queryParam.uSummary==='1'">
          <span class="queryLabel">车间：</span>
          <nz-select class="queryCmp" nzAllowClear (ngModelChange)="onChangeCj($event)"
            [(ngModel)]="queryParam.uWorkshop">
            <nz-option *ngFor="let option of cjList" [nzLabel]="option.opName" [nzValue]="option.opValue">
            </nz-option>
          </nz-select>
        </ng-container>
        <span class="queryLabel">工区：</span>
        <nz-select class="queryCmp" nzAllowClear (ngModelChange)="onChangeGq($event)"
          [(ngModel)]="queryParam.uWorkarea">
          <nz-option *ngFor="let option of gqList" [nzLabel]="option.opName" [nzValue]="option.opName">
          </nz-option>
        </nz-select>
        <span class="queryLabel">车站：</span>
        <nz-select class="queryCmp" nzAllowClear [(ngModel)]="queryParam.uStation">
          <nz-option *ngFor=" let option of czList" [nzLabel]="option.opName" [nzValue]="option.opName">
          </nz-option>
        </nz-select>
        <button class="margin-left10" nz-button nzType="primary" (click)="query(true)"
          [disabled]="noLeaving()">查询</button>
      </div>
    </div>
  </div>
  <div nz-row>

  </div>
  <div nz-row>
    <div nz-col nzSpan="24">
      <nz-table #nzTable_detail [nzData]="tableData" [nzLoadingDelay]="1000" nzBordered [nzShowPagination]="false"
        [nzFrontPagination]="false" [nzNoResult]="''" nzSize="small" [nzLoading]="loading" [nzScroll]="lockHeadScroll"
        [nzWidthConfig]="nzWidthConfig">
        <thead>
          <tr>
            <th *ngIf="queryParam.uSummary!=='1'" class="no-padding" nzAlign="center" rowspan="3" nzShowCheckbox
              (nzCheckedChange)="checkAll($event)" [nzDisabled]="noLeaving()">
            </th>
            <th class="no-padding" nzAlign="center" rowspan="3">状态</th>
            <th class="no-padding" nzAlign="center" rowspan="3">序号</th>
            <th class="no-padding" nzAlign="center" rowspan="3">工区</th>
            <th class="no-padding" nzAlign="center" rowspan="3">车站</th>
            <th class="no-padding" nzAlign="center" rowspan="3">维修<br>等级</th>
            <th class="no-padding" nzAlign="center" rowspan="3">计划<br>号</th>
            <th class="no-padding" nzAlign="center" rowspan="3">作业<br>项目</th>
            <th class="no-padding" nzAlign="center" rowspan="3">作业内容</th>

            <th class="no-padding" nzAlign="center" colspan="16">盯控项目</th>
            <th class="no-padding" nzAlign="center" rowspan="3">备注</th>
          </tr>
          <tr>
            <th class="no-padding" nzAlign="center" colspan="10" class="th-yellow">上道（线）过程控制 </th>
            <th class="no-padding" nzAlign="center" rowspan="2">作业过<br>程卡控<br>（选） </th>
            <th class="no-padding" nzAlign="center" colspan="5" class="th-green">
              下道（线）过程控制 </th>
          </tr>
          <tr>
            <th class="no-padding th-yellow" nzAlign="center">段调度<br>命令 </th>
            <th class="no-padding th-yellow" nzAlign="center">局调度<br>命令 </th>
            <th class="no-padding th-yellow" nzAlign="center">天窗计划<br>时间</th>
            <th class="no-padding th-yellow" nzAlign="center">上道（线）<br>时间</th>
            <th class="no-padding th-yellow" nzAlign="center">作业门编号</th>
            <th class="no-padding th-yellow" nzAlign="center">作业<br>人数</th>
            <th class="no-padding th-yellow" nzAlign="center">负责人</th>
            <th class="no-padding th-yellow" nzAlign="center">驻站<br>联络员</th>
            <th class="no-padding th-yellow" nzAlign="center">现场<br>防护员</th>
            <th class="no-padding th-yellow" nzAlign="center">工器<br>具</th>

            <th class="no-padding th-green" nzAlign="center">工器<br>具</th>
            <th class="no-padding th-green" nzAlign="center">人员</th>
            <th class="no-padding th-green" nzAlign="center">作业门</th>
            <th class="no-padding th-green" nzAlign="center">下道（线）<br>时间</th>
            <th class="no-padding th-green" nzAlign="center">天窗兑现<br>时间</th>
          </tr>
        </thead>
        <tbody class="table-body">
          <tr *ngFor="let data of tableData;index as i">
            <td class="no-padding" nzShowCheckbox [(nzChecked)]="data.checked"
              *ngIf="queryParam.uSummary!=='1'&&data._rowspan!==0" [nzDisabled]="noLeaving()"
              [attr.rowspan]="data._rowspan"></td>
            <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" nzAlign="center">
              <span [class]="statusFollow(data.uStatus)"></span><br>
              {{statusList[data._groupStatus]}}
            </td>
            <!-- 序号 -->
            <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" nzAlign="center">
              {{data._rowIndex}}
            </td>


            <ng-container *ngIf="queryParam.uSummary==='1';else editable" [ngTemplateOutlet]="rdTable">
            </ng-container>


            <ng-template #rdTable>
              <!-- 工区 -->
              <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" nzAlign="center">
                {{data.uWorkarea}}</td>
              <!-- 车站 -->
              <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" nzAlign="center">
                {{data.uStation}}</td>
              <!-- 维修等级 -->
              <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" nzAlign="center">
                {{data.uLevel}}</td>
              <!-- 计划号 -->
              <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" nzAlign="center">
                {{data.uWorknum}}</td>
              <!-- 作业项目 -->
              <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan">
                {{data.uProject}}</td>
              <!-- 作业内容 -->
              <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan">
                <div style="overflow-y: scroll;" [style.max-height]="(data._rowspan*45)+'px'"
                  [style.min-height]="'64px'">
                  {{data.uContent}}
                </div>
              </td>
              <!-- 段调度命令 -->
              <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan">
                {{data.uSegcmd}}</td>
              <!-- 局调度命令 -->
              <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan">
                {{data.uOfficecmd}}
              </td>
              <!-- 天窗计划时间 -->
              <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" nzAlign="center">
                {{data.uUpSkywintime}}
              </td>
              <!-- 上道（线）时间 -->
              <td class="no-padding" nzAlign="center">
                {{data.uUpTime}}
              </td>
              <!-- 作业门编号 -->
              <td class="no-padding" nzAlign="center">
                {{data.uUpWorkdoor}}
              </td>
              <!-- 作业人数 -->
              <td class="no-padding" nzAlign="center">
                {{data.uWorkpersonnum}}
              </td>
              <!-- 负责人 -->
              <td class="no-padding" nzAlign="center">
                {{data.uCharger}}
              </td>
              <!-- 驻站联络员 -->
              <td class="no-padding" nzAlign="center">
                {{data.uInperson}}
              </td>
              <!-- 现场防护员 -->
              <td class="no-padding" nzAlign="center">
                {{data.uOutperson}}
              </td>
              <!-- 工器具 -->
              <td class="no-padding" nzAlign="center">
                {{data.uUpTools}}
              </td>
              <!-- 作业过程卡控（选） -->
              <td class="no-padding">
                {{data.uWorkprocess}}
              </td>
              <!-- 工器具 -->
              <td class="no-padding" nzAlign="center">
                {{data.uDownTolls}}
              </td>
              <!-- 人员 -->
              <td class="no-padding" nzAlign="center">
                {{data.uDownPersons}}
              </td>
              <!-- 作业门 -->
              <td class="no-padding" nzAlign="center">
                {{data.uDownWorkdoor}}
              </td>
              <!-- 下道（线）时间 -->
              <td class="no-padding" nzAlign="center">
                {{data.uDownTime}}
              </td>
              <!-- 天窗兑现时间 -->
              <td class="no-padding" nzAlign="center">
                {{data.uDownSkywintime}}<br>({{data._uDownSkywintimeLen}}分钟)
              </td>
              <!-- 备注 -->
              <td class="no-padding">
                {{data.uNote}}
              </td>
            </ng-template>

            <ng-template #editable>
              <!-- 工区 -->
              <td *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" class="no-padding">
                <textarea class="table-textarea text-center" (keyup)="onChange($event,data,i,'','')"
                  [(ngModel)]="data.uWorkarea" [nzAutosize]="{minRows:10}"></textarea>
              </td>
              <!-- 车站 -->
              <td *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" class="no-padding">
                <!-- {{data.uStation}} -->
                <textarea class="table-textarea text-center" (keyup)="onChange($event,data,i,'','')"
                  [(ngModel)]="data.uStation" [nzAutosize]="{minRows:10}"></textarea>
              </td>
              <!-- 维修等级 -->
              <td *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" class="no-padding">
                <!-- {{data.uLevel}} -->
                <textarea class="table-textarea text-center" (keyup)="onChange($event,data,i,'','')"
                  [(ngModel)]="data.uLevel"></textarea>
              </td>
              <!-- 计划号 -->
              <td *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" class="no-padding">
                <!-- {{data.uWorknum}} -->
                <textarea class="table-textarea text-center" (keyup)="onChange($event,data,i,'','')"
                  [(ngModel)]="data.uWorknum" nzAutosize></textarea>
              </td>
              <!-- 作业项目 -->
              <td *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" class="no-padding">
                <!-- {{data.uProject}} -->
                <textarea class="table-textarea" (keyup)="onChange($event,data,i,'','')" [(ngModel)]="data.uProject"
                  [nzAutosize]="{minRows:10}"></textarea>
              </td>
              <!-- 作业内容 -->
              <td *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" class="no-padding">
                <!-- {{data.uContent}} -->
                <textarea class="table-textarea" (keyup)="onChange($event,data,i,'','')" style="overflow-y: scroll;"
                  [(ngModel)]="data.uContent" [nzAutosize]="{minRows:10,maxRows:(data._rowspan*5)}"></textarea>
              </td>
              <!-- 段调度命令 -->
              <td *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" class="no-padding">
                <!-- {{data.uSegcmd}} -->
                <textarea class="table-textarea" (keyup)="onChange($event,data,i,'','')" [(ngModel)]="data.uSegcmd"
                  nzAutosize></textarea>
              </td>
              <!-- 局调度命令 -->
              <td *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" class="no-padding">
                <!-- {{data.uOfficecm}} -->
                <textarea class="table-textarea" [(ngModel)]="data.uOfficecmd"
                  (keyup)="onChange($event,data,i,'','',true)" nzAutosize></textarea>
              </td>
              <!-- 天窗计划时间 -->
              <td *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" class="no-padding" nzAlign="center">
                <!-- {{data.uUpSkywintime}} -->
                <div>
                  <nz-time-picker [(ngModel)]="data._uUpSkywintime1" style="width: 70px;"
                    (ngModelChange)="onChange($event,data,i,'','')"
                    (nzOpenChange)="onTimeClick($event,data,'_uUpSkywintime1')" nzFormat="HH:mm" nzPlaceHolder=" ">
                  </nz-time-picker>
                </div>
                <div><span style="transform: rotate(90deg);">-</span></div>
                <div>
                  <nz-time-picker [(ngModel)]="data._uUpSkywintime2" style="width: 70px;"
                    (ngModelChange)="onChange($event,data,i,'','')"
                    (nzOpenChange)="onTimeClick($event,data,'_uUpSkywintime2')" nzFormat="HH:mm" nzPlaceHolder=" ">
                  </nz-time-picker>
                </div>
                <!-- <div style="display: flex;justify-content: space-evenly;flex-flow: column;">
                                    <nz-time-picker [(ngModel)]="data._uUpSkywintime1" style="width: 70px;"
                                        (ngModelChange)="onChange($event,data,i,'','')" nzFormat="HH:mm" nzPlaceHolder=" ">
                                    </nz-time-picker>
                                    <div><span style="transform: rotate(90deg);">-</span></div>
                                    <nz-time-picker [(ngModel)]="data._uUpSkywintime2" style="width: 70px;"
                                        (ngModelChange)="onChange($event,data,i,'','')" nzFormat="HH:mm" nzPlaceHolder=" ">
                                    </nz-time-picker>
                                </div> -->
              </td>
              <!-- 上道（线）时间 -->
              <td class="no-padding" nzAlign="center">
                <!-- {{data.uUpTim}} -->
                <nz-time-picker [(ngModel)]="data._uUpTime" (ngModelChange)="onChange($event,data,i,'','',true)"
                  (nzOpenChange)="onTimeClick($event,data,'_uUpTime')" style="width: 70px;" nzFormat="HH:mm"
                  nzPlaceHolder=" ">
                </nz-time-picker>
              </td>
              <!-- 作业门编号 -->
              <td class="no-padding" nzAlign="center">
                <!-- {{data.uUpWorkdoo}} -->
                <nz-select [(ngModel)]="data._uUpWorkdoor" nzMode="tags" [nzDropdownStyle]="{width:'150px'}"
                  nzDropdownMatchSelectWidth="false" [nzTokenSeparators]="[',','，','、']" style="width: 100px;"
                  (ngModelChange)="onChange($event,data,i,'','')" (nzOpenChange)="getZym(data)">
                  <nz-option *ngFor="let option of zymList" [nzLabel]="option.NAME" [nzValue]="option.NAME"></nz-option>
                </nz-select>
              </td>
              <!-- 作业人数 -->
              <td nzAlign="center" class="no-padding">
                <!-- {{data.uWorkpersonnu}} -->
                <textarea class="table-textarea text-center" [(ngModel)]="data.uWorkpersonnum"
                  (keyup)="onChange($event,data,i,'','')" rows="1"></textarea>
              </td>
              <!-- 负责人 -->
              <td class="no-padding">
                <!-- {{data.uCharge}} -->
                <textarea class="table-textarea text-center" [(ngModel)]="data.uCharger"
                  (keyup)="onChange($event,data,i,'','')" rows="1"></textarea>
              </td>
              <!-- 驻站联络员 -->
              <td class="no-padding">
                <!-- {{data.uInperso}} -->
                <textarea class="table-textarea text-center" [(ngModel)]="data.uInperson"
                  (keyup)="onChange($event,data,i,'','')" rows="1"></textarea>
              </td>
              <!-- 现场防护员 -->
              <td class="no-padding">
                <!-- {{data.uOutperso}} -->
                <textarea class="table-textarea text-center" [(ngModel)]="data.uOutperson"
                  (keyup)="onChange($event,data,i,'','')" rows="2"></textarea>
              </td>
              <!-- 工器具 -->
              <td class="no-padding">
                <!-- {{data.uUpTool}} -->
                <textarea class="table-textarea text-center" [(ngModel)]="data.uUpTools"
                  (keyup)="onChange($event,data,i,'','')" rows="1"></textarea>
              </td>
              <!-- 作业过程卡控（选） -->
              <td class="no-padding">
                <!-- {{data.uWorkproces}} -->
                <textarea class="table-textarea" [(ngModel)]="data.uWorkprocess" (keyup)="onChange($event,data,i,'','')"
                  nzAutosize></textarea>
              </td>
              <!-- 工器具 -->
              <td class="no-padding">
                <!-- {{data.uDownToll}} -->
                <textarea class="table-textarea text-center" [(ngModel)]="data.uDownTolls"
                  (keyup)="onChange($event,data,i,'','')" rows="1"></textarea>
              </td>
              <!-- 人员 -->
              <td class="no-padding">
                <!-- {{data.uDownPerson}} -->
                <textarea class="table-textarea text-center" [(ngModel)]="data.uDownPersons"
                  (keyup)="onChange($event,data,i,'','')" rows="1"></textarea>
              </td>
              <!-- 作业门 -->
              <td class="no-padding" nzAlign="center">
                <!-- {{data.uDownWorkdoo}} -->
                <!-- <textarea class="table-textarea" [(ngModel)]="data.uDownWorkdoor"
                                    (ngModelChange)="onChange($event,data,i,'','')" nzAutosize></textarea> -->
                <nz-select [(ngModel)]="data._uDownWorkdoor" nzMode="tags" [nzDropdownStyle]="{width:'150px'}"
                  nzDropdownMatchSelectWidth="false" [nzTokenSeparators]="[',','，','、']" style="width: 100px;"
                  (ngModelChange)="onChange($event,data,i,'','')" (nzOpenChange)="getZym(data)">
                  <nz-option *ngFor="let option of zymList" [nzLabel]="option.NAME" [nzValue]="option.NAME"></nz-option>
                </nz-select>
              </td>
              <!-- 下道（线）时间 -->
              <td class="no-padding" nzAlign="center">
                <!-- {{data.uDownTim}} -->
                <!-- <textarea class="table-textarea" [(ngModel)]="data.uDownTime"
                                    (ngModelChange)="onChange($event,data,i,'','')" nzAutosize></textarea> -->
                <nz-time-picker [(ngModel)]="data._uDownTime" nzFormat="HH:mm" style="width: 70px;"
                  (ngModelChange)="onChange($event,data,i,'','',true)"
                  (nzOpenChange)="onTimeClick($event,data,'_uDownTime')" nzPlaceHolder=" ">
                </nz-time-picker>
              </td>
              <!-- 天窗兑现时间 -->
              <td class="no-padding" *ngIf="data._rowspan!==0" [attr.rowspan]="data._rowspan" nzAlign="center">
                <!-- {{data.uDownSkywintim}} -->
                <div>
                  <nz-time-picker [(ngModel)]="data._uDownSkywintime1" style="width: 70px;"
                    (ngModelChange)="onChange($event,data,i,'time','')"
                    (nzOpenChange)="onTimeClick($event,data,'_uDownSkywintime1')" nzFormat="HH:mm" nzPlaceHolder=" ">
                  </nz-time-picker>
                </div>
                <div>
                  <span style="transform: rotate(90deg);">-</span>
                </div>
                <div>
                  <nz-time-picker [(ngModel)]="data._uDownSkywintime2" style="width: 70px;"
                    (ngModelChange)="onChange($event,data,i,'time','')"
                    (nzOpenChange)="onTimeClick($event,data,'_uDownSkywintime2')" nzFormat="HH:mm" nzPlaceHolder=" ">
                  </nz-time-picker>
                </div>
                <div>
                  <span class="text-cenzter">({{data.tcdhsjLen}}分钟)</span>
                  <!-- <span class="text-center">({{getTimeLen(data._uDownSkywintime1, data._uDownSkywintime2)}}分钟)</span> -->
                </div>
                <!-- <div><span class="text-center">({{data._uDownSkywintimeLen}}分钟)</span></div> -->
              </td>
              <!-- 备注 -->
              <td class="no-padding">
                <!-- {{data.uNote}} -->
                <textarea class="table-textarea" [(ngModel)]="data.uNote"
                  (keyup)="onChange($event,data,i,'','')"></textarea>
              </td>
            </ng-template>
          </tr>
        </tbody>
      </nz-table>
      <div class="pageWrap">
        每页
        <nz-select [(ngModel)]="pageSize" (ngModelChange)="query()" [disabled]="noLeaving()">
          <nz-option nzValue="20" nzLabel="20"></nz-option>
          <nz-option nzValue="50" nzLabel="50"></nz-option>
          <nz-option nzValue="100" nzLabel="100"></nz-option>
          <nz-option nzValue="200" nzLabel="200"></nz-option>
        </nz-select> 条
        &nbsp;&nbsp;&nbsp;作业组<span class="pageTotal">{{pageTotal}}</span>组
        &nbsp;&nbsp;&nbsp;计划<span class="pageTotal">{{totalPlanNum}}</span>条
        &nbsp;&nbsp;&nbsp;实验功能：
        <button class="margin-left10" nz-button nzType="default" (click)="changeHeight('down')" nzSize="small"><i
            nz-icon nzType="down" nzTheme="outline"></i>向下</button>
        <button class="margin-left10" nz-button nzType="default" (click)="changeHeight('up')" nzSize="small"><i nz-icon
            nzType="up" nzTheme="outline"></i>向上</button>
        <button class="margin-left10" nz-button nzType="primary" (click)="handSave()" nzSize="small"><i nz-icon
            nzType="save" nzTheme="outline"></i>全部保存</button>
      </div>
      <div class="pageInation">
        <nz-pagination [nzPageSize]="pageSize" [(nzPageIndex)]="pageIndex" [nzTotal]="pageTotal"
          (nzPageIndexChange)="query()" [nzDisabled]="noLeaving()"></nz-pagination>
      </div>
    </div>
  </div>

</div>